package com.cai.servlet.user;

import com.cai.dao.UserDao;
import com.cai.dao.impl.UserDaoImpl;
import com.cai.entity.User;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * @author RuoLi
 */
@WebServlet(name = "ServletUpdate", value = "/update")
public class ServletUpdate extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = request.getParameter("user_name");
        String user = request.getParameter("user_user");
        HttpSession session = request.getSession();
        if (username!=null&&user!=null){
            session.setAttribute("update_name",username);
            session.setAttribute("update_user",user);
            response.getWriter().println(1);
        }else {
            response.getWriter().println(0);
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
